//
//  TPDetailInfoBar.m
//  Yimei
//
//  Created by xiaowu xiaowu on 2017/10/25.
//  Copyright © 2017年 xiaowu xiaowu. All rights reserved.
//

#import "TPDetailInfoBar.h"
@interface TPDetailInfoBar()
@property (nonatomic,copy)NSArray *titles;


@end
@implementation TPDetailInfoBar

-(instancetype)init{
    if(self = [super init]){
        
        [self setup];
    }
    return self;
}
-(void)setup{
    
    NSArray *menus = @[@"TP_detail_make_icon",@"TP_detail_period_icon",@"TP_detail_time_icon"];
    NSInteger i = 1000;
    for(NSString *img in menus){
        
        TPButton *button = [TPButton buttonWithFrame:CGRectZero title:@"" font:fontSystemOfSize(10) color:TPBlack_999999];
        [button setImage:ImageNamed(img) forState:UIControlStateNormal];
        button.aligmentType = TPButtonAlignmentTypeLeft;
        button.tag = i;
        [button addTouchUpInsideTarget:self action:@selector(actionButtonClick:)];
        [self addSubview:button];
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(IPHONE_WIDTH/menus.count * (i-1000));
            make.top.bottom.mas_equalTo(0.0);
            make.width.mas_equalTo(IPHONE_WIDTH/menus.count);
        }];
        i++;
    }
    [[self tp_addLineTopWithColor:TP_COLOR_240] mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(-20.0);
        make.right.mas_equalTo(20.0);
    }];
    
}
-(void)setDetailModel:(TPProductDetailModel *)detailModel{
    _detailModel = detailModel;
    for(NSInteger i = 1000;i<1003;i++){
        TPButton *button = (TPButton *)[self viewWithTag:i];
        switch (i) {
            case 1000:
                [button setTitle:[NSString stringWithFormat:@"预约费用:￥%@",detailModel.reservation_fee] forState:0];
                break;
            case 1001:
                [button setTitle:[NSString stringWithFormat:@"疗程价:￥%@",detailModel.course_price] forState:0];
                break;
            case 1002:
                [button setTitle:[NSString stringWithFormat:@"时间:%@",xw_getNULLString(detailModel.time_duration)] forState:0];
                break;
                
                
            default:
                break;
        }
    }
}

-(void)actionButtonClick:(TPButton *)sender{
    
}
@end
